import axois from 'axios'
const state = {
  products:[]
}
const getters = {}
const mutations = {
  setProducts(state,payload){
    state.products = payload
  }
}
const actions = {
  async getProducts({commit}){
    const {data} = await axois({
      method:'GET',
      url:'http://127.0.0.1:3000/products',
    })
    commit('setProducts',data)
  }
}
export default {
  namespaced: true,
  state,
  getters,
  mutations,
  actions
}